import time

def bubble(num):
    for i in range(0, len(num) - 1):
        for k in range(len(num) - 1):
            if num[k] > num[k + 1]:
                temp = num[k]
                num[k] = num[k + 1]
                num[k + 1] = temp
    return num


def readline(filename):
    file = open(filename)
    data = file.readlines()
    return data


m1 = list(map(int, open('m1_sorted.txt')))
m2 = list(map(int, open('m2_reverse.txt')))
m3 = list(map(int, open('m3_shuffle.txt')))

t_start = time.time()
bubble(m1)
t_finish = time.time()
print("m1_sorted " + str(round((t_finish - t_start) * 1000)) + " milliseconds")

t_start = time.time()
bubble(m2)
t_finish = time.time()
print("m2_reverse " + str(round((t_finish - t_start) * 1000)) + " milliseconds")

t_start = time.time()
bubble(m3)
t_finish = time.time()
print("m3_shuffle " + str(round((t_finish - t_start) * 1000)) + " milliseconds")
